/*
 * This program is free software: you can redistribute it and/or modify it under
 * the terms of the GNU General Public License as published by the Free Software
 * Foundation, either version 3 of the License, or (at your option) any later
 * version.
 *
 * This program is distributed in the hope that it will be useful, but WITHOUT
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
 * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
 * details.
 *
 * You should have received a copy of the GNU General Public License along with
 * this program. If not, see <http://www.gnu.org/licenses/>.
 */
package org.merak.core.web;

import java.io.File;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;

import org.merak.core.model.parameter.IParameter;

/**
 * A WebParameter is an immutable parametric instanced property that
 * primary evaluates to a String or to a file.
 * @author fmarinho
 */

public interface WebParameter extends IParameter<String> {

	//~ Methods //////////////////////////////////////////////////////////////////
	//****************************************************************************
	public String getFileName();

	//****************************************************************************
	public String getFileType();

	//****************************************************************************
	public boolean hasFileType(String type);

	//****************************************************************************
	public long getLength();

	//****************************************************************************
	public boolean isUpload();

	//****************************************************************************
	/** Uploads and write the data to a temporary file.
	 * @throws Exception if the temporary file cannot be created or written to the disk */
	public File getFile() throws Exception;

	//****************************************************************************
	/** Uploads and write the data to the specified file.
	 * @throws Exception if the uploaded data cannot be written to the disk */
	public File getFile(File file) throws Exception;

	//****************************************************************************
	/** Uploads and returns a byte array.
	 * @throws IOException if the uploaded data cannot be written to the byte array */
	public byte[] getBytes();

	//****************************************************************************
	/** Uploads and returns an input stream.
	 * @throws IOException if the uploaded data cannot be written to the OutputStream */
	public InputStream getInputStream() throws IOException;

	//****************************************************************************
	/** Uploads and write the data to the specified output stream.
	 * @throws IOException if the uploaded data cannot be written to the OutputStream */
	public void writeToOutputStrem(OutputStream out) throws IOException;

	//****************************************************************************


}
